#!/usr/bin/python

import sys

# quota = int(sys.argv[1]) if len(sys.argv) > 1 else 1
conf = open('conf.py', 'r')
prop = eval(conf.read())
quota = prop['quota']

def output(word, count):
  if count >= quota:
    print '%s\t%d' % (word, count)

word, count = None, 0
for line in sys.stdin.readlines():
  line = line.strip()
  key, value = line.split('\t')
  if word != None and key != word:
    output(word, count)
    count = 0
  word = key
  count += int(value)
if word != None:
  output(word, count)
